const { defineConfig } = require('@vue/cli-service')
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave:false,
  chainWebpack: config => {
  	config.module.rule('wasm').test(/\.wasm$/).type('javascript/auto')
  },
  configureWebpack:{
    resolve:{
  	  extensions: ['.dev.js', '.js', '.json', '.wasm'],
  	  fallback: {
  	    crypto: false,
  	    path: false,
  	    fs: false
  	  },
    },
    plugins:[
  	  new NodePolyfillPlugin()
  	]
  },
  devServer: {
	  host: 'localhost', 
	  port: 3001, 
	  headers: { // 设置本地运行的跨域权限
		'Access-Control-Allow-Origin': '*',
		'Cross-Origin-Opener-Policy': 'same-origin',
		'Cross-Origin-Embedder-Policy': 'require-corp'
	  },
	}
})
